package com.wn.ziroom.config;


import com.wn.ziroom.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@ControllerAdvice(annotations = {RestController.class})
@ResponseBody
public class GlobalExceptionHandler {


    @ExceptionHandler(RuntimeException.class)
    public R exceptionHandler(RuntimeException e) {
        e.printStackTrace();
        return R.error("system error");
    }

}
